const { exec } = require("child_process");
const os = require("os");
const path = require("path");

function openPPTFile() {
  const pptFile = "C:\\Users\\18819055549\\Downloads\\彩色传媒简介2023-11.pptx";

  console.log(os.platform());

  // 判断当前环境是否是 Windows 环境
  if (os.platform() === "win32") {
    const command = `start "" "${path.resolve(pptFile)}"`;

    exec(command, (error, stdout, stderr) => {
      if (error) {
        console.error(`执行命令时出错: ${error}`);
      }
    });
  } else {
    console.error("当前环境不是 Windows 环境，无法打开本地 PPT 文件");
  }
}

openPPTFile();
